-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gcb: add gcb compatibility for provenance formats and buckets #292
gcb: add gcb compatibility for provenance formats and buckets #292
Conversation
Signed-off-by: Asra Ali <asraa@google.com>
9f17aab
to
dcb49d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit late but for posterity.
Type string `json:"type"` | ||
// DefinedInMaterial can be sent as the null pointer to indicate that | ||
// the value is not present. | ||
// DefinedInMaterial *int `json:"definedInMaterial,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a short local comment as to why this is commented out. Maybe point to comment at top of file.
@@ -0,0 +1,68 @@ | |||
package gcb | |||
|
|||
// Copy of github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/v0.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a "NOTE: " prefix to the comment.
if !strings.HasPrefix(expectedSourceURI, "https://") { | ||
|
||
// It is possible that GCS builds at level 2 use GCS sources, prefixed by gs://. | ||
if strings.HasPrefix(uri, "https://") && !strings.HasPrefix(expectedSourceURI, "https://") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: You might also leave a note as to why this is necessary in the first place. It's not necessarily obvious why "https://" might need to be prefixed at the beginning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, consider checking for any URI scheme rather than "https://" specifically. So you don't end up with strange URIs like "https://http://example.com/..." if the user enters "--source http://example.com"
if strings.HasPrefix(uri, "https://") && !strings.HasPrefix(expectedSourceURI, "https://") { | |
if strings.HasPrefix(uri, "https://") && !strings.HasPrefix(expectedSourceURI, "://") { |
Signed-off-by: Asra Ali asraa@google.com
This PR does two things in order to achieve GCB provenance compatibility:
definedInMaterial
field. Until GCB updates their provenance generation, this will have to do.v0.3
does not necessarily produce level 3 provenance, and we can only guarantee the provenance requirements (up to non-falsifiability for v0.3). We should definitely prioritize a versioning option in the future that would disallow generating provenance in a lower level mannger.Adds testcase for the JSON marshalling issue and the GCS Buckets.